﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Linq;
using System.Xml;

namespace GNSWebSite.Settings
{
    /// <summary>
    /// Settings return
    /// </summary>
    public static class SecuritySettings
    {
        #region Security
        public static XDocument _doc = XDocument.Load(HttpContext.Current.Server.MapPath("~/Settings/GnsSettings.xml"));
        /// <summary>
        /// password max length return
        /// </summary>
        public static int PasswordMaxLength
        {
            get
            {
                return
                    Convert.ToInt32(
                    _doc.Descendants("gnssettings").Elements("security").FirstOrDefault().Element("passwordmaxlength").Attribute("value")
                            .Value);
            }
        }
        /// <summary>
        /// number of alphanumeric characters return
        /// </summary>
        public static int NonAlphanumericChNum
        {
            get
            {
                return
                    Convert.ToInt32(
                        _doc.Descendants("gnssettings").Elements("security").FirstOrDefault().Element(
                            "nonalphanumericcharacters").Attribute("value").Value);
            }
        }

        /// <summary>
        /// Default radius to search events in kilomiters
        /// </summary>
        public static double DefaultRadius
        {
            get
            {
                return
                    Convert.ToDouble(
                    _doc.Descendants("gnssettings").Elements("lookup").FirstOrDefault().Element(
                            "defaultradius").Attribute("value").Value);
            }
        }
        #endregion
    }
}
